package com.runshu.newsmartark.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.runshu.newsmartark.R;
import com.runshu.newsmartark.entity.LogsManagerBean;

import java.util.List;

/**
 * Demo class
 *
 * @author yu
 * @date 2020/8/27
 * @decs：
 */

public class MyLogsAdapter extends BaseQuickAdapter<LogsManagerBean.ListBean, BaseViewHolder> {
    public MyLogsAdapter(@Nullable List<LogsManagerBean.ListBean> data) {
        super(R.layout.item_my_logs, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, LogsManagerBean.ListBean item) {

        helper.setText(R.id.tv_no, String.valueOf(helper.getAdapterPosition() + 1));
//        helper.setText(R.id.tv_code, item.getUserCode());
        helper.setText(R.id.tv_name, "操作人 / 时间："+item.getUserName());
        helper.setText(R.id.tv_pro_name, item.getGoodsName());
        helper.setText(R.id.tv_pro_guige, "规格型号：" + item.getGoodsModel());
        helper.setText(R.id.tv_pro_rfidID, "流水码：" + item.getRfidId());
        //0 入库; 1 出库
        if ("0".equals(item.getRfidType())) {
            helper.setText(R.id.tv_pro_change_state, "入库数量");
//            helper.setText(R.id.tv_change_num,  "+" + item.getStock());
            helper.setText(R.id.tv_change_num, "+" + 1);
            helper.setTextColor(R.id.tv_change_num, mContext.getResources().getColor(R.color.color_FF1DD483));
        } else if ("1".equals(item.getRfidType())) {
            helper.setText(R.id.tv_pro_change_state, "出库数量");
//            helper.setText(R.id.tv_change_num,  "-" + item.getStock());
            helper.setText(R.id.tv_change_num, "-" + 1);
            helper.setTextColor(R.id.tv_change_num, mContext.getResources().getColor(R.color.color_F15555));
        }
        helper.setText(R.id.tv_create_date,"/ "+ item.getCreateTime());


    }
}